﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using Sherwood.SignOn;

namespace Sherwood.CultureTesterUtility
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string[] cultures = txtCultures.Text.Split('\n');
            string output = "";
            foreach (string culture in cultures)
            {
                try
                {
                    string culturex = culture.Split(',')[0].Trim('"');
                    CultureInfo inf = new CultureInfo(culturex);
                    if (inf != null)
                    {
                        output += inf.Name + "\t" + (inf.IsNeutralCulture ? "neutral\t" : "\t") + inf.EnglishName + "\t" + inf.TwoLetterISOLanguageName + "/" + inf.ThreeLetterISOLanguageName + "\r\n";
                    }
                    else
                    {
                        output += "Not supported: " + culture + "\r\n";
                    }
                }
                catch
                {
                    output += "Not supported: " + culture + "\r\n"; ;
                }
            }
            txtCultureInfo.Text = output;
        }

        private void btnProfileXml_Click(object sender, EventArgs e)
        {
            getUserProfileResponse x = new getUserProfileResponse();
            x.attribute.Add(new attribute { name = "attributeA", source = "sourceA", value = "valueA" });
            x.attribute.Add(new attribute { name = "attributeB", source = "sourceA", value = "valueB" });
            x.role.Add(new role { name = "attributeA", source = "sourceA" });
            x.role.Add(new role { name = "attributeB", source = "sourceA" });
            x.culture.Add(new culture { name = "en-US", priority = 0 });
            x.culture.Add(new culture { name = "nb-NO", priority = 1 });
            x.country = "us";
            x.dateOfBirth = new DateTime(1900, 1, 1);
            x.email = "test@test.com";
            x.firstName = "Test";
            x.lastName = "User";
            x.mobile = "000";
            x.userAccountId = Guid.NewGuid().ToString();
            x.username = "test.user";
            txtProfileXml.Text = x.ToString();
        }
    }
}
